package com.jackrain.nea.sys;

import com.jackrain.nea.ModelConfig;
import com.jackrain.nea.core.db.DynamicDataSourceRegister;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * Created by jackrain on 16/8/6.
 */
@Slf4j
@Configuration//配置控制
@EnableAutoConfiguration//启用自动配置
@ComponentScan//组件扫描
@Import({ModelConfig.class,DynamicDataSourceRegister.class})
// public class SysApplication {
//
//     public static void main(String[] args) {
//         ApplicationContext applicationContext = SpringApplication.run(SysApplication.class, args);
//
//     }
// }
public class SysApplication extends SpringBootServletInitializer {

    static {
        System.setProperty("dubbo.application.logger","slf4j");
    }

    public static void main(String[] args) {
        System.setProperty("spring.devtools.restart.enabled","false");
        SpringApplication.run(applicationClass, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(applicationClass);
    }

    private static Class<SysApplication> applicationClass = SysApplication.class;

}
